Skip to content

feat: preflight-check batch:TagResource when tags are configured#53

Open
nh13 wants to merge 2 commits into
snakemake:mainfrom
nh13:nh_preflight-check-tags
Open

feat: preflight-check batch:TagResource when tags are configured#53
nh13 wants to merge 2 commits into
snakemake:mainfrom
nh13:nh_preflight-check-tags

Conversation

@nh13

@nh13 nh13 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

🔗 Stacked on #49 (preflight validation). This branch includes #49's commit, so the diff shows the preflight subsystem plus this change until #49 merges — then it slims to just this feature. Merge after #49.


When tags are configured (via --aws-batch-tags or the SNAKEMAKE_AWS_BATCH_JOB_TAGS environment variable), every job is tagged at submit time — so a missing batch:TagResource permission surfaces as an opaque AccessDenied an hour into the run. Extend _preflight_validate with a non-destructive tag/untag round-trip on the job-queue ARN so the gap fails fast at startup instead.

Only a permissions error raises a WorkflowError; any other error (or no tags configured / no queue ARN) degrades to a no-op. Adds tag_resource/untag_resource wrappers to BatchClient, 6 tests, and documents the batch:TagResource / batch:UntagResource needs.

Coordination: once this and #48 (minimal IAM policy docs) both land, #48's IAM section should add batch:UntagResource to the tags add-on.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@nh13, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2c8f5d61-a8a4-449f-90dd-6831c417c736

📥 Commits

Reviewing files that changed from the base of the PR and between 47e8027 and bfb28d8.

📒 Files selected for processing (5)
  • docs/further.md
  • snakemake_executor_plugin_aws_batch/__init__.py
  • snakemake_executor_plugin_aws_batch/batch_client.py
  • tests/test_preflight.py
  • tests/tests_mocked_api.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nh13
nh13 force-pushed the nh_preflight-check-tags branch from 74290a0 to ab4de23 Compare July 16, 2026 17:26
nh13 added 2 commits July 16, 2026 14:11
…role

Run a best-effort validation in __post_init__, before any job is submitted, so
a definitively misconfigured setup fails fast with a clear error instead of
leaving jobs stuck forever:

- _queue_problems(): inspect the configured job queue and its compute
  environment(s); report a disabled/invalid queue or compute environment, a
  fatal queue status (INVALID/DELETING/DELETED), or maxvCpus=0.
- _preflight_validate(): raise WorkflowError on any confirmed problem, then
  check the job role.
- _validate_job_role(): iam:GetRole existence check; NoSuchEntity fails fast,
  anything else (most importantly a missing iam:GetRole permission) degrades.

The check is conservative about uncertainty: a transient API error, a queue
mid-update, or a missing describe/iam permission degrades to a debug message
and the workflow proceeds. Only a confirmed-bad configuration blocks. Documented
in docs/further.md; the workflow-level mocked test short-circuits preflight the
same way it short-circuits platform detection.
When tags are set (via --aws-batch-tags or SNAKEMAKE_AWS_BATCH_JOB_TAGS), every
job is tagged at submit time, so a missing batch:TagResource surfaces as an
opaque AccessDenied an hour into the run. Extend _preflight_validate with a
non-destructive tag/untag round-trip on the job queue ARN so the permission gap
fails fast at startup instead. Only a permissions error raises; any other error
(or no tags / no queue ARN) degrades to a no-op. Adds tag_resource/untag_resource
wrappers to BatchClient and documents the batch:TagResource/UntagResource needs.
@nh13
nh13 force-pushed the nh_preflight-check-tags branch from ab4de23 to bfb28d8 Compare July 16, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant